package com.ruoyi.qsng.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.uuid.SnowFlakeUtil;
import com.ruoyi.qsng.domain.KActivityCollect;
import com.ruoyi.qsng.mapper.KActivityCollectMapper;
import com.ruoyi.qsng.service.IKActivityCollectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 活动收藏Service业务层处理
 *
 * @author kanglou
 * @date 2023-06-07
 */
@Service
public class KActivityCollectServiceImpl implements IKActivityCollectService {
    @Autowired
    private KActivityCollectMapper kActivityCollectMapper;

    /**
     * 查询活动收藏
     *
     * @param id 活动收藏主键
     * @return 活动收藏
     */
    @Override
    public KActivityCollect selectKActivityCollectById(String id) {
        return kActivityCollectMapper.selectKActivityCollectById(id);
    }

    /**
     * 查询活动收藏列表
     *
     * @param kActivityCollect 活动收藏
     * @return 活动收藏
     */
    @Override
    public List<KActivityCollect> selectKActivityCollectList(KActivityCollect kActivityCollect) {
        return kActivityCollectMapper.selectKActivityCollectList(kActivityCollect);
    }

    /**
     * 新增活动收藏
     *
     * @param kActivityCollect 活动收藏
     * @return 结果
     */
    @Override
    public int insertKActivityCollect(KActivityCollect kActivityCollect) {
        kActivityCollect.setId(SnowFlakeUtil.getNextId());
        kActivityCollect.setCreateTime(DateUtils.getNowDate());
        return kActivityCollectMapper.insertKActivityCollect(kActivityCollect);
    }

    /**
     * 修改活动收藏
     *
     * @param kActivityCollect 活动收藏
     * @return 结果
     */
    @Override
    public int updateKActivityCollect(KActivityCollect kActivityCollect) {
        kActivityCollect.setUpdateTime(DateUtils.getNowDate());
        return kActivityCollectMapper.updateKActivityCollect(kActivityCollect);
    }

    /**
     * 批量删除活动收藏
     *
     * @param ids 需要删除的活动收藏主键
     * @return 结果
     */
    @Override
    public int deleteKActivityCollectByIds(String[] ids) {
        return kActivityCollectMapper.deleteKActivityCollectByIds(ids);
    }

    /**
     * 删除活动收藏信息
     *
     * @param id 活动收藏主键
     * @return 结果
     */
    @Override
    public int deleteKActivityCollectById(String id) {
        return kActivityCollectMapper.deleteKActivityCollectById(id);
    }
}
